package com.nhim.cms.dao;

import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Repository;

import com.nhim.cms.dao.ITestDAO;
import com.nhim.cms.domain.Test;
import com.nhim.core.dao.CoreDAO;

@Repository("testDAO")
public class TestDAO extends CoreDAO<Integer, Test> implements
		ITestDAO {
	
	@Autowired
	EntityManagerFactory entityManagerFactory;
	
	@PostConstruct
	public void init() {
		super.setEntityManagerFactory(entityManagerFactory);
	}
	public static TestDAO getFromApplicationContext(ApplicationContext ctx) {
		return (TestDAO) ctx.getBean(TestDAO.class);
	}
}
